<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="pragma" content="no-cache">  <!-- HTTP 1.1 -->
    <meta http-equiv="cache-control" content="no-cache,must-revalidate">  <!-- HTTP 1.0 -->
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/> <!--优先级：极速模式，兼容模式，IE模式-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <title>扬州房产测绘业务管理系统</title>
    <link rel="stylesheet" type="text/css" href="../../libs/jeasyui-181/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../libs/jeasyui-181/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../../libs/jeasyui-181/themes/color.css">
    <link rel="stylesheet" type="text/css" href="../../css/common.css">
    <script type="text/javascript" src="../../libs/jeasyui-181/jquery.min.js"></script>
    <script type="text/javascript" src="../../libs/jeasyui-181/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../libs/thUtil.js"></script>
    <script type="text/javascript">

        var mainGrid = new UserContol();

        $(function () {
            if (UrlParm.hasParm('text')) {
                $('h1').html(UrlParm.parm('text'));
            }
            mygrid.init();
        });

        var ajax = {
            getList: function (param, success) {
                Network.connect(window.api.caseList, 'POST', param, function (res) {
                    if (res.code === ResponseCode.OK) {
                        success(res.data);
                    }
                });
            },
            send: function () {
                dlg = top.$.hDialog({
                    href: window.router.caseForm + '?n=' + Math.random(),
                    title: '发送案件',
                    width: 700,
                    height: 350,
                    onLoad: function () {
                        var row = mygrid.selectRow();
                        ajax.getProcessList(function (res) {
                            var arr =[];
                            var list = res.data.rows;
                            for (var i=0;i<list.length;i++){
                               arr.push({id:i+1,text:list[i].name,modelId:list[i].id});
                            }
                            top.$("#processType").combobox('loadData', arr).combobox({onChange:function (newVal, oldVal) {
                               top.$("#modelKey").textbox("setValue",arr[newVal-1].modelId);
                            }});
                        })
                    },
                    submit: function () {
                        var isValid = top.$('#form').form("validate");
                        if (isValid) {

//                            var formData = top.$("#form").serializeJson();
//                            Network.connect(window.api.modelInsert, 'POST', formData, function (res) {
//                                if (res.code === ResponseCode.OK) {
//                                    //  Tools.show('添加成功');
//                                    dlg.dialog('close');
//                                    window.location.href = "../modeler.html?modelId="+res.data;
//                                    // mygrid.reload();
//                                }
//                            });
                        }
                    }
                });
            },
            resort: function () {
                Tools.confirm('是否确定重新整理数据？', function (result) {
                    if (result) {
                        Network.connect(window.api.groupReSort, 'POST', {}, function (res) {
                            if (res.code === ResponseCode.OK) {
                                Tools.show('重新整理成功');
                                mygrid.reload();
                            }
                        });
                    }
                });
            },
            getProcessList:function (methods) {
                Network.connect(window.api.modelSelectPageList,"POST",{},methods)
            }
        };

        var mygrid = {
            init: function () {
                mainGrid.dataGrid.id = 'mainGrid';
                mainGrid.dataGrid.idField = 'ID';
                //   mainGrid.dataGrid.sortName = 'USERID';
                mainGrid.dataGrid.sortOrder = 'asc';
                mainGrid.dataGrid.toolbar = '#toolbar';
                mainGrid.dataGrid.onLoadSuccess = function (data) {
                    if (data.total === 0)
                        setEmptyData($(this));
                    $(".easyui-linkbutton").linkbutton();
                };
                mainGrid.dataGrid.loader = function (param, success, error) {
                    ajax.getList(param, success);
                };
                mainGrid.dataGrid.columns = [[
                    {field: 'id', title: '编号', halign: 'center', align: 'center', width: 100, iconCls: 'icon-cancel'},
                    {field: 'name', title: '名称', halign: 'center', align: 'left', width: 250},
                    {field: 'createDate', title: '创建时间', halign: 'center', align: 'center', width: 300},
                    {field: 'area', title: '行政区域', halign: 'center', align: 'center', width: 100},
                    {field: 'processType', title: '流程类型', halign: 'center', align: 'center', width: 200},
                    {field: 'businessName', title: '业务名称', halign: 'center', align: 'center', width: 200},
                    {field: 'taskLevel', title: '任务等级', halign: 'center', align: 'center', width: 100},
                    {field: 'customName', title: '客户名称', halign: 'center', align: 'center', width: 100},
                    {field: 'contact', title: '联系人', halign: 'center', align: 'center', width: 100},
                    {field: 'note', title: '备注', halign: 'center', align: 'center', width: 100},
                    {
                        field: 'workflowCtl', title: '案件处理', halign: 'center', align: 'center', width: 100,
                        formatter: function (val,row,index) {
                            return '<a class="easyui-linkbutton l-btn insert" data-options="iconCls:\'icon-send-emails\'" href="javascript:void(0)" onclick="ajax.send(\'' + row.id + '\')" >发送</a>';
                        }
                    }
                ]];
                mainGrid.InitdataGrid();
            },
            reload: function () {
                $('#mainGrid').datagrid('reload');
            },
            selectRow: function () {
                return $('#mainGrid').datagrid('getSelected');
            }
        };

    </script>

</head>
<body>
<div class="container-wrap">
    <div id="toolbar">
        <div class="container-tit">
            <h1></h1>
        </div>
        <div class="sreach fixed">
            <!--<input type="text" class="easyui-textbox" data-options="label:'上级部门:',labelWidth: 80,width:240,"/>
            <a href="#" class="easyui-linkbutton search">查询</a>-->
            <div class="bar-btn">
                <a id="insert_Link" href="#" class="easyui-linkbutton insert">新增</a>
                <a id="update_Link" href="#" class="easyui-linkbutton update">编辑</a>
                <a id="delete_Link" href="#" class="easyui-linkbutton delete">删除</a>
            </div>
        </div>
    </div>
    <div id="mainGrid"></div>
</div>
</body>
</html>